
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>搜索</title>
        <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
        <meta content="yes" name="apple-mobile-web-app-capable"/>
        <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
        <meta content="telephone=no" name="format-detection"/>
        <link href="../Ryancss/search.css" rel="stylesheet" type="text/css"/>

    </head>
    <body> 
	
	
	<section class="aui-flexView">

	<section class="aui-scrollView">
		<div class="aui-cost-head">
			<div class="aui-search-box">
				<i class="icon icon-search"></i>
				<input type="text" placeholder="输入关键词搜索" autofocus="autofocus"  id="ff-wd" >
				
					<div class="aui-button-once"   tapmode onclick="Search_button()" >
						 <button >搜一下</button>
					</div>
							
			</div>
			<div class="aui-cost-link">
				<h2>热门搜索</h2>
				<span id="Hot_search_list">
				</span>
			<!--	<a   tapmode onclick="sousuo('人在')">人在</a>
				<a   tapmode onclick="sousuo('绝密')">绝密</a> -->
			</div>
		</div>

		<div class="aui-tab" data-ydui-tab>
			<ul class="tab-nav b-line">
				<li class="tab-nav-item tab-active">
					<a >
						<span>近期观看记录</span>
					</a>
				</li>

			</ul>
			<div class="tab-panel">
				<div class="tab-panel-item tab-active"   id="list" > 
				
				
				<script id="list_template" type="text/x-dot-template">
					<a onclick="go_detail('{{=it.url}}', '{{=it.title}}');"  class="aui-flex aui-flex-clear-pd b-line">
						<div class="aui-cost-img-sm">
							<img src="{{=it.logo}}">
						</div>
						<div class="aui-flex-box">
							<h2>{{=it.title}}</h2>
						</div>
					</a>
					
				</script>
			




			
	<!--			
					<a href="javascript:;" class="aui-flex aui-flex-clear-pd b-line">
						<div class="aui-cost-img-sm">
							<img src="https://i.loli.net/2019/06/24/5d1093ac7dc5341583.png">
						</div>
						<div class="aui-flex-box">
							<h2>苹果PD快充套装锤子QC40原装拆机18W快充充电器安卓现Type-C数据线</h2>

						</div>
					</a>
-->

				</div>
			</div>
		</div>
		<div style="height:55px;"></div>


	</section>


</section>
	

    </body>
	
	
	
	
	
	
	
	<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.js"></script>
<script type="text/javascript" src="../script/doT.js"></script>
<script type="text/javascript" src="../script/date.min.js"></script>
	
	<script type="text/javascript">



	var api_url = localStorage.getItem('api_url');
    var jx_url1 = localStorage.getItem('jx_url1');
	var list_template;
	//var	secretkey = '';
	
	var s = localStorage.getItem('Hot_search');
	ss = s.split(",");// 在每个逗号(,)处进行分解。
	
	var	secretkey = localStorage.getItem('app_secret_key');		//key
	apiready = function(){
	
	    api.parseTapmode();
	
		list_template = $("#list_template").text();
		update();


	
	//	ss = mycars.split(",");// 在每个逗号(,)处进行分解  ["abc", "abcd", "aaa"]
	


		//		alert(JSON.stringify(ss));
		
				 //调用方法渲染 推荐搜索关键词
				fnInitView(ss)




							// 网络状态
		api.addEventListener({
			name:'offline'
		}, function(ret, err){        

			api.toast({
			msg : '网络连接异常',
			duration : 5000,
			location : 'middle' 
			});

			  

		});

		api.addEventListener({
			name:'online'
		}, function(ret, err){        
		
			  api.toast({
			  msg : '已经连接网络',
			  duration : 2000,
			  location : 'middle' 
			  });
				  
		update();

				  
		});	






	};
	

	
	
	    function fnInitView(data) {

        //声明容器 并置空
        var Hot_search_list_html = '';
        //遍历页面数据的数组进行创建标签,插入容器
        for (var i = 0; i < data.length; i++) {
		

		
            Hot_search_list_html += '	<a   tapmode onclick="sousuo('+'\''+data[i]+'\''+')">' + data[i] +'</a>  	 ';

						

        };
        $api.byId('Hot_search_list').innerHTML = Hot_search_list_html;
    };

	
	
	
	
	
	function update(){
		api.ajax({
	        url: api_url+'/login/login/newjilu_Ten?uid=' + localStorage.getItem('user_id')
        },function(ret,err){
        	//coding...
        	if(ret.code==0){
        		//$("#list").empty();
      		$("#list").html('<div  class="empty">   <img style="width: 100%;"src=""></div>');
 	 // 	$("#list").html('<section class="m-noRecord"><div class="c-icon-noRecord"></div> <div class="c-info">'+ ret.msg +'</div></section>'); 


        		return;
        	}


        	var array = ret.msg;
        	//alert(JSON.stringify(ret));
        	for(var i=0;i<array.length;i++){
        		var p = array[i];
        		      if(p.ping =="优酷"){
        			p["logo"] = ""
					
        		}else if(p.ping == "爱奇艺"){
        			p["logo"] = ""
					
      			}else if(p.ping == "腾讯"){
        			p["logo"] = ""
					
				}else if(p.ping == "搜狐"){
							p["logo"] = ""
				
				}else if(p.ping == "PPTV"){
							p["logo"] = ""
				
				}else if(p.ping == "芒果"){
							p["logo"] = ""
				
				}else if(p.ping == "M1905"){
							p["logo"] = ""
				
				}else if(p.ping == "暴风"){
							p["logo"] = ""
				
				}else if(p.ping == "乐视"){
							p["logo"] = ""
				
				}else if(p.ping == "风行"){
							p["logo"] = ""
				
				}else if(p.ping == "未知"){
							p["logo"] = ""
        		}
        		var date_str = "";
        		try{
        			var date = new Date();
        			date.setTime(p.time*1000);
        			date_str = date.format('MM-dd hh:mm');
        		}catch(e){
        		}
        		p["date_str"] = date_str;

        	}

	   		var text = "";

			for(var i=0;i<array.length;i++){
				var p = array[i];
				text = text + doT.template(list_template)(p);
			}
			$("#list").html(text);


        });
	}





//打开播放记录
	function go_detail(dataurl2, page_title){

    var time = localStorage.getItem('user_time');
    var user_id = localStorage.getItem('user_id');
    var username = localStorage.getItem('user_name');
    var timestamp = Date.parse(new Date())/1000;
    if(user_id<1){
   /*   api.alert({
          title: '温馨提示',
          msg: '请先登陆后使用',
	  */
      api.openWin({    

          name: 'login',
          url: './login.html',
          delay: 300,
	//	    });
					
											
						
				bounces: false,
				slidBackEnabled: true,
				bgColor: '#000',
				animation: {
					type: "reveal", //动画类型（详见动画类型常量） 
					subType: "from_right", //动画子类型（详见动画子类型常量）
					duration: 400
				},
				vScrollBarEnabled: false
						
						
      });
      return;

    }

    if (time>timestamp) {
      api.showProgress({
          title: 'VIP登录中...',
          modal: false
      });
      setTimeout("playRadio();",1000);
      var delay = 0;
      if(api.systemType != 'ios'){
          delay = 300;
      }


		api.hideProgress();


			
	
		api.openWin({
           name: 'video_jiexi_play_win',
           url: './video_jiexi_play_win.html',
           delay: 300,
           pageParam:{
           		url:jx_url1+dataurl2,
           		srcUrl:dataurl2,
           		title:page_title,
           		needRecordHistory: false
           	},
           //pageParam:{url:dataurl2},
           bgColor: '#000000'
       });
	   
	   



    }else if (time == -1) {
      api.showProgress({
          title: 'VIP登录中...',
          modal: false
      });
      setTimeout("playRadio();",2000);
      var delay = 0;
      if(api.systemType != 'ios'){
          delay = 300;
      }
	  
	  
		api.hideProgress();
	  

				
	
		api.openWin({
           name: 'video_jiexi_play_win',
           url: './video_jiexi_play_win.html',
           delay: 300,
           pageParam:{
           		url:jx_url1+dataurl2,
           		srcUrl:dataurl2,
           		title:page_title,
           		needRecordHistory: false
           	},
           //pageParam:{url:dataurl2},
           bgColor: '#000000'
       });
	   
	   


    }else if (time<timestamp){
	
	
			VipExpiredHint();   //会员过期提示
		  
    }

  }

	  
		  


	////////////////////搜索方法///////////////////////////

	  function sousuo(value){


//	var wd = $api.val($api.byId('ff-wd'));
	var wd = value;

	    if (wd == '') {
		
	  //   SearchIsEmpty();   //空 提示
	   
               api.toast({
                    msg: '请输入关键词',
                    duration: 2000,
					location : 'middle'   
                });
	  
	      api.hideProgress();
		  
	    }else if (wd == secretkey){

					var delay = 0;
					if(api.systemType != 'ios') {
						delay = 300;
					}

					
					api.openWin({
						name: 'video_secret_win',
						url: './video_secret_win.html', 
						bounces: false,
						delay: delay,
						slidBackEnabled: true,
				bgColor: '#000',
				animation: {
					type: "reveal", //动画类型（详见动画类型常量）
					subType: "from_top", //动画子类型（详见动画子类型常量）
					duration: 400
				},
						vScrollBarEnabled: false
					});



 
	  }else{
	  
					api.ajax({
					url: api_url + '/login/login/Movies_Search_List.html',
					method: 'get',
					data: {
						values: {
							key: 'p2piunink',  //安全码
							search_key: wd
						}
					}
				}, function(ret, err) {
					if(ret) {
						api.hideProgress();
					
					
					//	alert( JSON.stringify( ret.msg ) );	
					
				//	localStorage.setItem('search_video',ret.msg['search']);   // 搜索结果
					
					
						if(ret.code > 0){
						
							
								/*	api.toast({
										msg: ret.msg['title'],
										duration: 2000,
										location : 'middle'   
									});
								*/
												
						api.openWin({
							name: 'search_video_win',
							url: 'search_video_win.html',
							bounces: false,
							delay: delay,
							slidBackEnabled: true,
							vScrollBarEnabled: false,
						
							pageParam:{search_video_key:wd,search_num:ret.code}
						});
	
								
								
								
						}else{
						
						
									api.openWin({
										name: 'video_win',
										url: './video_win.html',
										pageParam: {
											url: 'http://m.v.qq.com/search.html?act=0&keyWord=' + wd
										  }
									  });
							
							}
						
						
					}else{
						api.hideProgress();
										 
						api.openWin({
							name: 'video_win',
							url: './video_win.html',
							pageParam: {
								url: 'http://m.v.qq.com/search.html?act=0&keyWord=' + wd
							  }
						  });
						  
					}

				});  	  
	  
	  }

	}
		  
		  
		  
		  
  //会员权限判断
  function Search_button(){
  
  	var value = $api.val($api.byId('ff-wd'));
  
    var time = localStorage.getItem('user_time');
    var user_id = localStorage.getItem('user_id');
    var username = localStorage.getItem('user_name');
    var timestamp = Date.parse(new Date())/1000;
    if(user_id<1){
   /*   api.alert({
          title: '温馨提示',
          msg: '请先登陆后使用',
	  */
      api.openWin({    

          name: 'login',
          url: './login.html',
          delay: 300,
	//	    });
					
											
						
				bounces: false,
				slidBackEnabled: true,
				bgColor: '#000',
				animation: {
					type: "reveal", //动画类型（详见动画类型常量） 
					subType: "from_right", //动画子类型（详见动画子类型常量）
					duration: 400
				},
				vScrollBarEnabled: false
						
						
      });
      return;

    }

    if (time>timestamp) {

      setTimeout("playRadio();",1000);
      var delay = 0;
      if(api.systemType != 'ios'){
          delay = 300;
      }


		api.hideProgress();


			sousuo(value);



    }else if (time == -1) {

      setTimeout("playRadio();",2000);
      var delay = 0;
      if(api.systemType != 'ios'){
          delay = 300;
      }
	  
	  
		api.hideProgress();
	  

			sousuo(value);


    }else if (time<timestamp){
	
	
			VipExpiredHint();   //会员过期提示
		  
    }

  }

	  
		  
		  
		  
		  
		  

	////////////////////搜索方法///////////////////////////















	    //////////////////////    搜索方法为空提示  方法  SearchIsEmpty   S  //////////////////////
	    function SearchIsEmpty() {

	                      /*搜索方法为空提示*/
	                      var dialogBox = api.require('dialogBox');
	                      dialogBox.alert({
	                          tapClose: true,  //描述：（可选项）是否点击遮罩层关闭该对话框  默认值：false
	                    /*       texts: {
	                              content: '我还不知道你想看什么',
	                              leftBtnTitle: '在想想',
	                              rightBtnTitle: '去续费'
	                          },   */
	                          styles:{
	                    bg: '#fff',            //（可选项）字符串类型；对话框整体背景配置，支持#、rgb、rgba、img；默认：#fff
	                    corner: 10,             //（可选项）数字类型；对话框背景圆角大小；默认：2
	                    w: 300,                //（可选项）数字类型；对话框的宽；默认：300
	                    title:{                //（可选项）JSON对象；弹窗标题栏样式配置，不传则不显示标题区域
	                        marginT: 20,       //（可选项）数字类型；标题栏与对话框顶端间距；默认：20
	                        icon: 'widget://image/app/SearchIsEmpty.png',          //（可选项）字符串类型；标题前面的图标路径，要求本地路径（widget://、fs://）；图片为正方形的，如：50*50、100*100，建议开发者传大小合适的图片以适配高分辨率手机屏幕，不传则不显示
	                        iconSize: 200,      //（可选项）数字类型；icon 图标边长大小,若 icon 不存在则此参数无效；默认：24
	                        titleSize: 2,     //（可选项）数字类型；标题字体大小；默认：14
	                        titleColor: '#000' //（可选项）字符串类型；标题字体颜色，支持#、rgb、rgba；默认：#fff
	                    },
	                    content:{              //（可选项）JSON 对象；文本内容配置，若不传则不显示该区域
	                        marginT: 20,       //（可选项）数字类型；内容文本顶端与标题栏底端的距离，如果标题栏不存在，则是到窗口顶端的距离；默认：20
	                        marginB: 40,       //（可选项）数字类型；内容文本底端与 left/right 顶端的距离，如果 left/right 都不存在，则是到对话框底端的距离；默认：20
	                        color: '#ff0072',     //（可选项）字符串类型；内容文本字体颜色，支持 rgb、rgba、#；默认：#eee
	                        size: 12           //（可选项）数字类型：内容文本字体大小；默认：12
	                    },

	                }
	                      });
	                      /*    搜索方法为空提示    */

	    }
	    //////////////////////    搜索方法为空提示 方法 SearchIsEmpty  E  //////////////////////






 //  会员过期 弹窗提示
 function VipExpiredHint(){
 
	var dialogBox = api.require('dialogBox');
	dialogBox.alert({
	tapClose:true,			//允许点击遮罩关闭弹窗
    texts: {  
        title: '操作失败',
        content: '您的超级会员已过期',   //调用后台设置内容
        leftBtnTitle: '等下',
        rightBtnTitle: '升级'
    },
    styles: {
			bg: '#fff',
			w: 300,
			corner:10,
			title: {
				marginT: 20,
				icon: 'widget://Ryanimg/frame0/rrrr.png',
				iconSize: 20,
				titleSize: 14,
				titleColor: '#999'
			},
			content: { 
				marginT: 20,       //（可选项）数字类型；内容文本顶端与标题栏底端的距离，如果标题栏不存在，则是到窗口顶端的距离；默认：20
				marginB: 20,       //（可选项）数字类型；内容文本底端与 left/right 顶端的距离，如果 left/right 都不存在，则是到对话框底端的距离；默认：20
				color: '#999',
				size: 14 
			},
			left: {
				marginB: 30,
				marginL: 30,
				w: 100,
				h: 35,
				corner: 2,
				bg: '#eeeeee',
				color: '#999',  //（可选项）字符串类型；右边按钮标题字体颜色，支持rgb、rgba、#；默认：'#007FFF'
				size: 12
			},
			right: {
				marginB: 30,
				marginL: 40,
				w: 100,
				h: 35,
				corner: 2,
				bg: '#ff1679',
				color: '#fff',  //（可选项）字符串类型；右边按钮标题字体颜色，支持rgb、rgba、#；默认：'#007FFF'
				size: 12
			}
			
			
		
		}
	}, function(ret) {
						
																			
					if (ret.eventType == 'left') {
						var dialogBox = api.require('dialogBox');
						dialogBox.close({
							dialogName: 'alert'
						});
					} else if(ret.eventType == 'right') {
																			
						api.openWin({
						name: 'upgrade_vip_win',
						url: './upgrade_vip_win.html',
						delay: 300
					});
																					     
							    
						var dialogBox = api.require('dialogBox');
						dialogBox.close({
						dialogName: 'alert'
						});
																					
					}
				});
 
 }
 








	</script>
	
	
</html>
